Socket
Socket
Sign inDemoInstall

table-layout

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

table-layout

Stylable text tables, handling ansi colour. Useful for console output.


Version published
Weekly downloads
1.8M
increased by9.68%
Maintainers
1
Weekly downloads
 
Created

What is table-layout?

The table-layout package is a utility for Node.js that allows for the easy formatting of text into a table structure. It provides a way to organize data in rows and columns, with options for customizing alignment, width, and padding. This package is useful for CLI tools and scripts that need to present data in a structured, readable format.

What are table-layout's main functionalities?

Basic table layout

This feature allows you to create a basic table layout by specifying an array of objects, where each object represents a row in the table. The keys of the object represent column names.

const Table = require('table-layout');
const data = [{ colA: 'row 1 column A', colB: 'row 1 column B' }, { colA: 'row 2 column A', colB: 'row 2 column B' }];
const table = new Table(data);
console.log(table.toString());

Custom column width and wrapping

This feature demonstrates how to customize the width of columns and enable text wrapping. It is useful for controlling the appearance of the table and ensuring that it fits within a specific layout.

const Table = require('table-layout');
const data = [{ name: 'Some really long name that exceeds the default column width', age: '30' }];
const options = { columns: [{ name: 'name', width: 30, nowrap: true }, { name: 'age', width: 10 }] };
const table = new Table(data, options);
console.log(table.toString());

Other packages similar to table-layout

Keywords

FAQs

Package last updated on 06 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc